<note important>Cette page est en cours de rédaction</note>

====== Installation ======
===== à partir des dépôts =====

<note warning>Les paquet présent dans raring semblent ne pas fonctionner</note>

Installer les paquets **[[apt>python-pocketsphinx libpocketsphinx1 gstreamer0.10-pocketsphinx python-pyaudio]]**

<code>
apt-get install python-pocketsphinx libpocketsphinx1 gstreamer0.10-pocketsphinx python-pyaudio
</code>
===== à partir des sources =====

D'abord il faut installer les dépendances
<code>
sudo apt-get build-dep pocketsphinx
sudo apt-get install bison python-pyaudio
</code>

==== sphinxbase ====

On récupère ensuite les sources de **sphinxbase-0.8**
<code>
wget -O sphinxbase-0.8.tar.gz http://sourceforge.net/projects/cmusphinx/files/sphinxbase/0.8/sphinxbase-0.8.tar.gz/download
</code>
On les décompresse
<code>
tar -xvzf sphinxbase-0.8.tar.gz
</code>
On compile
<note important>
Si vous avez l'erreur :
<code>
    import pocketsphinx as ps
  File "sphinxbase.pxd", line 150, in init pocketsphinx (pocketsphinx.c:7935)
ValueError: PyCapsule_GetPointer called with invalid PyCapsule object
</code>
il faut régénérer le fichier  python/sphinxbase.c [[http://sourceforge.net/p/cmusphinx/bugs/284/#b6ea|ref]]
<code>
sudo apt-get install cython
mv python/sphinxbase.c ~
</code>
puis relancer la compilation a partir de ./configure
</note>

<note tip>Par défaut au moment de la configuration de sphinxbase, si les librairies de compilation de pulseaudio sont installées elles seront utilisées.
Si comme moi vous devez utiliser Alsa, il faut supprimer la librairie pulseaudio :
<code>
sudo apt-get remove libpulse-dev

</code>
</note>
<code>
./configure --prefix=/usr/local
make
sudo make install
</code>


==== pocketsphinx ====
<code>
wget -O pocketsphinx-0.8.tar.gz http://sourceforge.net/projects/cmusphinx/files/pocketsphinx/0.8/pocketsphinx-0.8.tar.gz/download
tar -xvzf pocketsphinx-0.8.tar.gz
cd pocketsphinx-0.8
./configure --prefix=/usr/local
make
sudo make install
</code>

===== modèles français =====

Téléchargement:
<code>
wget -O lium_french_f0.tar.gz http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20F0%20Broadcast%20News%20Acoustic%20Model/lium_french_f0.tar.gz/download
tar -xvzf lium_french_f0.tar.gz
cd lium_french_f0/
sudo mkdir /usr/share/pocketsphinx/model/FR/
sudo mv * /usr/share/pocketsphinx/model/FR/

wget -O french3g62K.lm.dmp.bz2 http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20Language%20Model/french3g62K.lm.dmp.bz2/download
bzip2 -d french3g62K.lm.dmp.bz2
sudo mv french3g62K.lm.dmp /usr/share/pocketsphinx/model/FR/

wget -O frenchWords62K.dic http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20Language%20Model/frenchWords62K.dic/download
sudo mv frenchWords62K.dic /usr/share/pocketsphinx/model/FR/


wget -O lium_french_f2.tar.gz http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20F2%20Telephone%20Acoustic%20Model/lium_french_f2.tar.gz/download

</code>

===== Bon alors, est ce que ça marche ? =====
==== pocketsphinx_continuous ====
<code>
pocketsphinx_continuous -dict /usr/share/pocketsphinx/model/FR/frenchWords62K.dic -hmm /usr/share/pocketsphinx/model/FR/ -lm /usr/share/pocketsphinx/model/FR/french3g62K.lm.dmp
</code>
====== références ======

Site officiel : http://cmusphinx.sourceforge.net/wiki/download/

Python audio : http://people.csail.mit.edu/hubert/pyaudio/docs/

Exemple en python: http://pythonism.wordpress.com/2013/06/06/pocketsphinx-voice-recognition-with-python/

http://stackoverflow.com/questions/8567366/geting-ioerror-errno-input-overflowed-9981-when-setting-pyaudio-stream-input